<?php

namespace App\Http\Controllers;

use Illuminate\Support\Facades\DB;
use App\Libs\HttpServe;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Log;
use App\Jd\JdClient;
use App\Jd\Api\NewWareBaseproductGetRequest;//错误代码67
use App\Jd\Api\WareProductsortGetRequest;

class TestJDResController extends Controller
{

    
    /**
     * Create a new controller instance.
     *
     * @return void
     */
    public function __construct()
    {
        //
    }

    /**
     * 回调入口
     */
    public function index(Request $request, HttpServe $serve)
    {
        $jdClient  = new JdClient();
        $jdClient->appKey = "AF77656B81311761CB31C274B699A271";
        $jdClient->appSecret = "7bf7d7200eeb4414b0f03dc828dc431c";
        $jdClient->accessToken = "e09cae4a-654c-4af7-be64-7f24f80a2a34";
        $jdClient->serverUrl = "https://api.jd.com/routerjson";
        
        $req =  new WareProductsortGetRequest();
        $req->setProductSortIds("652,833");
        
        $resp = $jdClient->execute($req, $jdClient->accessToken);
        // Log::debug("[test]", [json_encode($resp)]);
        var_dump((array)$resp);
        // $this->assertTrue(true);
    }
    
    
    
    
}
